異端な開発者を許ぃたってチョ☆

異端な開発者=尾画茶の記事

ホーム 連絡をする 同期する ( RSS 2.0 ) Login
投稿数  26  : 記事  0  : コメント  194  : トラックバック  3

ニュース

ブログは初めて & よーわからん & 苦手です…… ルールがわかっていないので、ご無礼してしまったときはお許しください。

書庫

日記カテゴリ

コミュニティー

ブックマーク

初心者向け

.NET Framework 3.5 になってから、色々な便利機能や名前空間が増えた。その中でも、お気に入りは、System.Xml.Linq 名前空間だ。XMLを扱うのに、非常に簡素で素敵な機能を提供してくれている。

まず、Document を考えなくても、Element 単位で考えられるところがよい。XElement は、たとえば、以下のように生成できる。

            var x = new XElement("要素", new XAttribute("属性", "値"),
                        new XElement("子要素",
                            new XElement("孫要素")
                        )
                    );

ここでの x の中身は次のようになる。

<要素 属性="値">
  <子要素>
    <孫要素 />
  </子要素>
</要素>

つまり、階層構造を真似て記述でき、引数を複数指定できるので、ありのままの XML を記述できる。また、Namespace を制御する XNamespace もシンプルで冴えている。string と同じような扱いをするように設計されており、コンストラクタがない。使い方は、

XNamespace n = "http://schema.wankuma.com/";

と、こんな感じ。XElement などに指定する時も、string にならって、

var x2 = new XElement( n + "要素名" );

と、こんな書き方である。しかし、n は string ではなく、あくまでも XNamespace。x2.Name は、string 型ではなく、名前空間とノード名が一つになった XName 型である。要素名を取り出すときは、x2.Name.LocalName となる。

System.Xml 名前空間は W3C に準拠して設計されたと思われるが、System.Xml.Linq 名前空間は、最適化された全く別の設計思想(つまりはLINQ)に基づいていると思う。

投稿日時 : 2008年7月17日 0:22

コメント

# re: 素晴らしい System.Xml.Linq 名前空間。便利な XElement。 2008/07/17 10:41 Streetw☆
PasteXmlAsLinqというアドインはご存知ですか?
クリップボード内のXMLからXElementのコードを作ってくれます~

# re: 素晴らしい System.Xml.Linq 名前空間。便利な XElement。 2008/07/17 12:25 尾画茶
Streetw☆さま、興味深いコメントをありがとうございます。
アドインという機能拡張の存在は知っていたものの、まったく活用したことはありませんでした。
調べてみると、他にも様々なアドインが、VS標準で、ZIP圧縮されているようですね。
PasteXmlAsLinq は、テスト用途に活用できそうです。VB.net はXMLリテラルがあるから必要ないかもしれませんが、C# には便利ですよね。

# best place to buy careprost https://bimatoprostrx.com
bimatoprost generic best price
2021/12/13 16:01 Hksfnjkh
best place to buy careprost https://bimatoprostrx.com
bimatoprost generic best price


# buy doxycycline cheap https://doxycyline1st.com/
generic for doxycycline 2022/02/26 8:21 Jusidkid
buy doxycycline cheap https://doxycyline1st.com/
generic for doxycycline

# doxy https://doxycyline1st.com/
doxycycline hyc 2022/02/26 17:48 Jusidkid
doxy https://doxycyline1st.com/
doxycycline hyc

# generic clomiphene http://clomidus.store/ 2022/04/12 20:25 Clomids
generic clomiphene http://clomidus.store/

# can you buy prednisone https://prednisoneus.shop/ 2022/04/17 6:46 Prednisone
can you buy prednisone https://prednisoneus.shop/

# drug finasteride https://finasteridemen.com/
2022/05/11 23:48 Finasteride
drug finasteride https://finasteridemen.com/


# lasix pills https://buylasix.icu/
lasix side effects 2022/06/25 1:05 LasixRx
lasix pills https://buylasix.icu/
lasix side effects

# clomid 100 mg tablet https://clomidonline.icu/ 2022/07/12 23:50 Clomidj
clomid 100 mg tablet https://clomidonline.icu/

# ivermectin dose for goats with lice https://stromectolbestprice.com/ 2022/07/30 8:19 BestPrice
ivermectin dose for goats with lice https://stromectolbestprice.com/

# comfortis without vet prescription: https://medrxfast.com/ 2022/08/07 8:47 MedsRxFast
comfortis without vet prescription: https://medrxfast.com/

# cost of prednisone tablets https://deltasone.icu/
can you buy prednisone over the counter in usa 2022/08/22 17:34 Prednisone
cost of prednisone tablets https://deltasone.icu/
can you buy prednisone over the counter in usa

# best non prescription ed pills https://ed-pills.xyz/
online ed medications 2022/09/16 14:49 EdPills
best non prescription ed pills https://ed-pills.xyz/
online ed medications

# best drug for ed https://ed-pills.xyz/
best ed medications 2022/09/17 2:55 EdPills
best drug for ed https://ed-pills.xyz/
best ed medications

#  https://clomidforsale.site/ 2022/11/13 21:19 ForSale
https://clomidforsale.site/

# prednisone 20mg capsule https://prednisonepills.site/
drug prices prednisone 2022/11/30 7:54 Prednisone
prednisone 20mg capsule https://prednisonepills.site/
drug prices prednisone

# ed meds online - https://cheapdr.top/# 2023/04/03 9:33 Dikolipo
ed meds online - https://cheapdr.top/#

# where to get doxycycline - https://doxycyclinesale.pro/# 2023/04/21 23:21 Doxycycline
where to get doxycycline - https://doxycyclinesale.pro/#

# muscle relaxer over the counter https://overthecounter.pro/# 2023/05/08 23:01 OtcJikoliuj
muscle relaxer over the counter https://overthecounter.pro/#

# buy ed pills: https://edpills.pro/# 2023/05/15 22:15 EdPillsPro
buy ed pills: https://edpills.pro/#

# ed meds online https://pillswithoutprescription.pro/# 2023/05/16 9:47 PillsPro
ed meds online https://pillswithoutprescription.pro/#

# Paxlovid buy online https://paxlovid.pro/# - paxlovid 2023/07/02 23:12 Paxlovid
Paxlovid buy online https://paxlovid.pro/# - paxlovid

# order cytotec online https://cytotec.ink/# - buy cytotec in usa 2023/07/26 20:29 PillsFree
order cytotec online https://cytotec.ink/# - buy cytotec in usa

# internet apotheke 2023/09/26 12:07 Williamreomo
http://onlineapotheke.tech/# online apotheke preisvergleich
п»?online apotheke

# online apotheke gГјnstig 2023/09/26 23:01 Williamreomo
http://onlineapotheke.tech/# internet apotheke
versandapotheke

# versandapotheke deutschland 2023/09/27 3:44 Williamreomo
https://onlineapotheke.tech/# internet apotheke
online apotheke gГ?nstig

# gГјnstige online apotheke 2023/09/27 4:12 Williamreomo
http://onlineapotheke.tech/# online apotheke gГ?nstig
versandapotheke

# online apotheke deutschland 2023/09/27 4:38 Williamreomo
https://onlineapotheke.tech/# versandapotheke versandkostenfrei
online apotheke deutschland

# farmacia online piГ№ conveniente 2023/09/27 21:10 Rickeyrof
acheter sildenafil 100mg sans ordonnance

# comprare farmaci online con ricetta 2023/09/27 22:32 Rickeyrof
acheter sildenafil 100mg sans ordonnance

# pharm canada 2023/10/16 21:50 Dannyhealm
Their global network ensures the best medication prices. https://mexicanpharmonline.com/# mexico drug stores pharmacies

# canada pharmacies online 2023/10/17 11:58 Dannyhealm
Efficient, reliable, and internationally acclaimed. https://mexicanpharmonline.com/# mexico drug stores pharmacies

# canada drug stores 2023/10/17 15:58 Dannyhealm
Love their spacious and well-lit premises. http://mexicanpharmonline.shop/# mexican rx online

# www canadian pharmacies 2023/10/17 22:09 Dannyhealm
Their commitment to international standards is evident. http://mexicanpharmonline.com/# mexican border pharmacies shipping to usa

# canadian pharamacy 2023/10/17 23:19 Dannyhealm
Their team understands the nuances of global healthcare. http://mexicanpharmonline.shop/# pharmacies in mexico that ship to usa

# no prescription on line pharmacies 2023/10/18 0:26 Dannyhealm
Love their range of over-the-counter products. http://mexicanpharmonline.com/# mexico drug stores pharmacies

# canadian pharmecy 2023/10/18 4:57 Dannyhealm
The best place for quality health products. https://mexicanpharmonline.shop/# mexican rx online

# top mail order pharmacies 2023/10/18 12:34 Dannyhealm
Their commitment to global excellence is unwavering. http://mexicanpharmonline.com/# mexican border pharmacies shipping to usa

# online mexican pharmacies 2023/10/18 13:43 Dannyhealm
Always ahead of the curve with global healthcare trends. http://mexicanpharmonline.shop/# reputable mexican pharmacies online

# top canadian pharmacies 2023/10/18 17:47 Dannyhealm
They have a great range of holistic health products. https://mexicanpharmonline.com/# mexican border pharmacies shipping to usa

# mexico drug store online 2023/10/19 11:34 Dannyhealm
Their commitment to global excellence is unwavering. https://mexicanpharmonline.shop/# pharmacies in mexico that ship to usa

# paxlovid generic https://paxlovid.bid/ paxlovid generic 2023/10/25 23:08 Paxlovid
paxlovid generic https://paxlovid.bid/ paxlovid generic

# best ed treatment pills 2023/11/21 1:40 WilliamApomb
http://edpills.monster/# best otc ed pills

# ï»¿paxlovid 2023/12/01 7:25 Mathewhip
paxlovid http://paxlovid.club/# paxlovid covid

# pharcharmy online no script 2023/12/03 10:55 MichaelBum
http://clomid.club/# clomid tablet

# farmaci senza ricetta elenco https://farmaciait.pro/ farmacia online migliore 2023/12/04 10:19 Farmacia
farmaci senza ricetta elenco https://farmaciait.pro/ farmacia online migliore

# farmacias online baratas 2023/12/07 21:56 RonnieCag
http://vardenafilo.icu/# farmacia online envío gratis

# farmacia envíos internacionales 2023/12/08 4:11 RonnieCag
https://vardenafilo.icu/# farmacia online 24 horas

# farmacia barata 2023/12/08 7:12 RonnieCag
https://sildenafilo.store/# sildenafilo cinfa 25 mg precio

# farmacia envíos internacionales 2023/12/08 12:47 RonnieCag
http://vardenafilo.icu/# farmacias online seguras en españa

# farmacias online seguras en españa 2023/12/08 18:38 RonnieCag
http://sildenafilo.store/# comprar sildenafilo cinfa 100 mg españa

# farmacia envíos internacionales 2023/12/09 22:56 RonnieCag
http://tadalafilo.pro/# farmacia online barata

# farmacia online envío gratis 2023/12/10 12:20 RonnieCag
http://tadalafilo.pro/# farmacias online seguras

# farmacia online envío gratis 2023/12/11 17:36 RonnieCag
http://vardenafilo.icu/# farmacia envíos internacionales

# ï»¿farmacia online 2023/12/12 10:32 RonnieCag
https://vardenafilo.icu/# farmacia online envío gratis

# farmacias online seguras en españa 2023/12/12 13:23 RonnieCag
https://vardenafilo.icu/# farmacias online seguras

# farmacia envíos internacionales 2023/12/12 16:29 RonnieCag
http://vardenafilo.icu/# farmacia online 24 horas

# farmacia 24h 2023/12/13 3:02 RonnieCag
https://vardenafilo.icu/# farmacia online 24 horas

# Acheter médicaments sans ordonnance sur internet 2023/12/13 19:27 Larryedump
http://pharmacieenligne.guru/# Pharmacie en ligne France

# Pharmacie en ligne fiable 2023/12/15 19:58 Larryedump
https://pharmacieenligne.guru/# Pharmacies en ligne certifiées

# Acheter médicaments sans ordonnance sur internet 2023/12/15 23:32 Larryedump
https://pharmacieenligne.guru/# Pharmacies en ligne certifiées

# acheter medicament a l etranger sans ordonnance 2023/12/16 8:04 Larryedump
http://pharmacieenligne.guru/# Pharmacies en ligne certifiées

# buy cheap clomid price 2023/12/26 18:43 RaymondGrido
http://prednisone.bid/# prednisone cream rx

# abella danger filmleri https://abelladanger.online/ Abella Danger
2024/03/06 11:01 Adella
abella danger filmleri https://abelladanger.online/ Abella Danger


# Clava is the best 2025/05/04 20:26 Danielthash
Greatest news for all us

Post Feedback

タイトル
名前
Url:
コメント