IBM Developer is your one-stop location for getting hands-on training and learning in-demand skills on relevant technologies such as generative AI, data science, AI, and open source.
æ¦è¦ çããæ®æ®µä½ä½¿ã£ã¦XMLãHTMLæ¸ãã¦ã¾ã? ããã§ã¯Emacsã®ã¡ã¸ã£ã¼ã¢ã¼ãã®ä¸ã¤ã§ããPSGMLããç´¹ä»ãï¼æ¥½ã ãã¼ã¯ã¢ããçæ´»ããããçºã®æºåã¨ï¼PSGMLã®ä½¿ãæ¹ãç°¡åã«èª¬æãããã¨æãã¾ãï¼ ç¹å¾´ PSGMLã¯æ¥µãã¦å¼·åã§ï¼æ©è½ãè±å¯ã«ããã®ã§ããï¼æ大ã®ç¹å¾´ã¯ããã®ææ¸åã®DTDãPSGMLèªèº«ã解éãã¦ãã®å ´æã«æé©ãªè¦ç´ åã§è£å®ãã¦ããã(è¥ããã¯æ¿å ¥ãã¦ããããï¼ãªã¹ãã¢ãããã¦ããã)äºãï¼ããã«ãã£ã¦ï¼ãå ¨é¨ã®è¦ç´ ã®è¦ªåé¢ä¿ãèªåãæ¶ãã¦ããªãã¦ãæèããæ£ãããã¼ã¯ã¢ããããããã¨ãåºæ¥ãäºãã«ããã¨äºããã®ã§ã¯ãªããã¨æãã¾ãï¼ ä¾ãã°ææ¸åãXHTML1.1ã®HTMLãç·¨éãã¦ããã¨ãã¾ãããï¼bodyè¦ç´ ç´ä¸ã®ããç®æã«çªå·ä»ãç®æ¡æ¸ã (ol)ãå ¥ããããªã£ãã¨ãã¾ãï¼PSGMLã§ã¯è¦ç´ ãæ¿å ¥ãããæ Control + c (Controlãã¼ã
ã¯ããã« PSGMLã¢ã¼ãã¯SGMLãç·¨éããããã®ã¢ã¼ãã ããXMLãHTMLã«ç¹åãã XMLã¢ã¼ããHTMLã¢ã¼ããå«ã¾ãã¦ãã¾ããPSGMLã¢ã¼ãã§ã¯DTDããã ã¨å¹¸ãã«ãªãã¾ããéã«è¨ãã¨DTDãç¡ãã¨ãã¯ä½¿ã£ã¦ããã¾ãå¬ãã ããã¾ããã è¨å® (autoload 'xml-mode "psgml" "Major mode to edit XML files." t) ;;; RELAXãRELAX NGãxml-modeã§éã (setq auto-mode-alist (append '(("\\.\\(xml\\|rlx\\|rng\\)$" . xml-mode)) auto-mode-alist)) ;;; XHTMLã¯hoge.xhtml.jaã®ããã«.xhtmlã®å¾ã«æ¡å¼µåãã¤ãã¦ããã (setq auto-mode-alist (append '(("\\.
ä»æããåã³Java SE 6å®å ¨æ»ç¥ã«æ»ãã¾ãããã 4æã«ã¯Java SE 6ã«ãããXMLã«é¢ããæ°æ©è½ã¨ãããã¨ã§ï¼StAXãç´¹ä»ãã¾ãããä»æãXMLã«é¢ããæ°æ©è½ã§ããJava Architecture for XML Bindingï¼é称JAXBãç´¹ä»ãã¾ãã JAXBã¯Java SE 6ããä¸è¶³æ©ãï¼Java EE 5ã§æ¡ç¨ããã¦ããã®ã§ï¼ãåãã®æ¹ãå¤ãã¯ãã§ãã JAXBã説æããåã«ï¼XMLãç¨ãã¦ãã¼ã¿äº¤æãè¡ãªãå ´åã«ã¤ãã¦èãã¦ã¿ã¾ãããã é常ï¼Javaã®ã¢ããªã±ã¼ã·ã§ã³ã§XMLããã¥ã¡ã³ããæ±ãå ´åï¼XMLããã¥ã¡ã³ãããã¼ã¹ãï¼ãã¼ã¹ããå 容ãã¢ããªã±ã¼ã·ã§ã³ã§æ±ãããããªãã¸ã§ã¯ãã«å¤æãã¾ãã ãã¨ãã°ï¼æ¬¡ã®ãããªååã表ãXMLããã£ãã¨ãã¾ãã
è²ã ã¨ããããªç¶æ³ã ã£ãã®ã§æ´çã Ruby 1.8.7 Rails 2.2.2 rspec 1.1.11 rspec-rails 1.1.11 rcov 0.8.1.2.0 ã¨ãããããrake specãï¼åå®è¡ãããã®ã§ãvendor/plugins以ä¸ã®rspecã¨rspec-railsãæ¶ãã¾ãã ãããããrake spec:rcovãå®è¡ã % rake spec:rcov ï¼ä¸ç¥ï¼ /opt/local/lib/ruby/1.8/rexml/formatters/pretty.rb:131:in `[]': no implicit conversion from nil to integer (TypeError) from /opt/local/lib/ruby/1.8/rexml/formatters/pretty.rb:131:in `wrap' from /opt/
Shitf-JISã§XMLã£ã¦ã®ãããããã©ããã¨æããã©ã #!/usr/bin/ruby -Ks require 'rexml/document' doc = REXML::Document.new() doc << REXML::XMLDecl.new('1.0', 'SHIFT-JIS') test = doc.add_element('test', {"hoge" => "表"}) doc.write(STDOUT) ã¨ã©ã¼ï¼ $ ruby test.rb /usr/lib/ruby/1.8/rexml/encodings/ICONV.rb:11:in `conv': "表'" (Iconv::IllegalSequence) from /usr/lib/ruby/1.8/rexml/encodings/ICONV.rb:11:in `encode' from /usr/lib/
XHTML ãæ¸ãã¨ã ã¡ãã㨠DOCTYPE 宣è¨ã§æ£ãã DTD ã示ããã¦ããã°ã xmllint ã§ç°¡åã«ããªãã¼ã·ã§ã³ãåºæ¥ã¾ãã $ xmllint --valid --noout hoge.html便å©ã§ãã ããªãã¼ã·ã§ã³ãéããªãã£ãå ´åã¯ãæ ¹æ ã¨ãªã DTD ã表示ãããã®ã§åå¼·ã«ããªãã¾ãã Another HTML Lint ããããã§ããã© xmllint ã®ããªãã¼ã·ã§ã³ãéãã°ãã¼ã¿ã¨ãã¦ã¯æ£ããã®ã§ã xmllint ã ãã§ååã¨ããã°ååã Another HTML Lint ãªã©ã®ãã¨ã¬ã¬ã³ããããè¨ãé¡ãã®ãã®ã¯åèç¨åº¦ã«ãã¦ããã¦ããã¨ã¬ã¬ã³ãããã¯èªåã§æ¢ãã¦ããã»ããæ£ããæ°ããã¾ãã
libxml2ã¯3ã¤ã®ã¹ãã¼ãè¨èªãå®è£ XMLãã¼ãµlibxml2ã¯åªããã©ã¤ãã©ãªããã¼ã«ã§ãDTDã¯ãã¡ãããXML SchemaãRELAX NGã使ã£ã¦ãXMLææ¸ãæ¤è¨¼ã§ãã¾ããããã ãã§3ã¤ã®ã¹ãã¼ãè¨èªãå®è£ ããã®ã§ãã¹ãã¼ãå®ç¾©ãè¤æ°ã®è¨èªã§ç¨æããå ´åãªã©å¤§å¤éå®ãã¾ãã XMLãã¼ãµlibxml2ã使ã£ã¦å®éã«æ¤è¨¼ libxml2ã¯Cè¨èªã§æ¸ãããXMLãã¼ãµã§ãããè¤æ°ã®ã©ã¤ãã©ãªããã¼ã«ãæä¾ãã¾ããã¾ãããªã¼ãã³ã½ã¼ã¹ã®ãã¹ã¯ãããç°å¢ãæä¾ããGnomeããã¸ã§ã¯ãã®ä¸ç°ã§ãããMITã¨ããã©ã¤ã»ã³ã¹ã«ããæä¾ããã¦ãã¾ããä»åã¯libxml2ã®ã³ãã³ãã©ã¤ã³ãã¼ã«ã§ããxmllintã使ã£ã¦XMLææ¸ãæ¤è¨¼ãã¦ã¿ã¾ããã¾ãæãåºæ¬ã¨ãªã使ãæ¹ãè¦ã¦ã¿ã¾ãããã xmllint [ãªãã·ã§ã³] XMLãã¡ã¤ã« ä¸è¨ã®æ§æã«ããããXMLãã¡ã¤ã«ãã解æãã¾ãã
æå®ã®XMLææ¸ãæ£ãããã©ã¼ãããã§ãããããã§ãã¯ããã ããããLintãã¼ã«ã§ãã XMLææ¸ã®ã¤ã³ãã³ããæ´ãããã¨ãã§ãã¾ãã (Windows, Mac) æ¦è¦ xmllintã¯ãxmlã®æ¤è¨¼ãè¡ãLintãã¼ã«ã§ãã æå®ããXMLããæ£ãããã©ãããå¤å®ãããã¨ãã§ãã¾ãã ã¾ããXMLãã¡ã¤ã«ãæ´å½¢ãããã¨ãã§ãã¾ãã vimã¨ãã£ã¿ã§ã¯ãã¸ã¥ã¢ã«ã¢ã¼ãã§ãè¡ãé¸æãã¦ã=ããã¼ãæ¼ãã°ã ããã¥ã¡ã³ããæ´å½¢ãããã¨ã¯ã§ããã®ã§ãããããã«ãéçãããã¾ãã " å ¨è¡ãã©ã¼ãããã®ã³ãã³ãä¾ vgG= ä¾ãã°ã次ã®ãããªå½¢å¼ã®XMLããã¥ã¡ã³ãã¯ã ä¸è¨ã®æ¹æ³ã§ã¯æ£ããæ´å½¢ã§ãã¾ããã <root><parent><child><subchild>DOCUMENT</subchild></child><child> <subchild>TEXT</subchild></
Rubyã§xmlãç·¨éããããã«ãREXML㧠xml = '' doc.root.write(xml) ã¨ãREXML::Element.writeã使ã£ããã REXML::Element.write is deprecated. See REXML::Formatters ã¨ããããã®ã§ãREXML::Formattersã使ã£ã¦ã¿ã¾ããã xml = '' formatter = REXML::Formatters::Default.new formatter.write(doc.root, xml) REXML::Formatters::Defaultã¯ãXMLããã®ã¾ã¾åºåãã¾ãã REXML::Formatters::Prettyã¯ãXMLãæ´å½¢ãã¦åºåãã¾ãã xml = '' formatter = REXML::Formatters::Pretty.new format
katoy: cocolog "è²å³æ¯ç©º 空å³æ¯è²" ãã®æã ã«èå³ããã£ããã¨ãæ¸ãã¦ããã¾ãã ä»ã¯ java, ruby, jruby, xfy ... MacOS ä¸ã§ java, ruby, scala ã試ãã¦ãã¾ãã ( http://twitter.com/katoy ) 2007-02-09: http://katoy.justblog.jp/katoy_justblog/ ãä½æãã¾ããã 2006-12-12: å³ã®ãµã¤ãã¡ãã¥ã¼ã®ä¸é¨ã« bloglines ã§ã® feed ä¸è¦§è¡¨ç¤ºãããããã«ãã¦ã¿ã¾ããã(2007 以éã表示ãæ¢ãã¾ãã) http://astore.amazon.co.jp/katoy-22 ã®ã¤ã³ã¹ã¿ã³ãã¹ãã¢ãè¦ãã¦ã¿ã¦ãã ããã
Perlã®XML::Simple ã®ruby port ã§ããxml-simple(http://xml-simple.rubyforge.org/)ã使ã£ã¦ã¿ãï¼XMLãï¼é£æ³ï¼é åã«ããããã¦ããã¾ãï¼ ã¤ã³ã¹ãã¼ã« gem install xml-simple 使ãæ¹ èª¬æã®ãµã³ãã«ã¯ï¼http://xml-simple.rubyforge.org/ ããï¼ require ã§ã¯ï¼xml-simpleã§ã¯ãªãï¼xmlsimpleã§ãããã¨ã«æ³¨æï¼ require 'rubygems' require 'xmlsimple' xml = %q( <config logdir="/var/log/foo/" debugfile="/tmp/foo.debug"> <server name="sahara" osname="solaris" osversion="2.6"> <addres
HOMMEZ(ãªã ãº)ã¯ç·æ§ã®å¿ã¨èº«ä½ã®å¥åº·ãæ¯æ´ããä¸äººã§ãå¤ãã®äººãåä¾ãå¾ã幸ããç·æ§ã¨ãã¦ã®åã³ã享åã§ãã社ä¼ã®å®ç¾ãç®æãã¦ãã¾ããç·æ§ã®å¦æ´»ãæ´»åã«ã¾ã¤ããæ å ±ãååã®åã§æ§ãå¦æ´»ã«æ©ãç·æ§ãå¹ççã«ç´å¾æãæã£ã¦æ´»åã§ããæ©ä¼ãåµåºãã¾ãã
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}