How Namespaces Can Tubing Your XPath Queries in C#

Posted by on under small indefinite quantity, xpath queries, query string, persal, code string, movenext, null string, c project, model code, level2, period 4, xml document, current value, webservices, bits and pieces, sharpness, depository, artifact, encrypt, bz |

I was excavation on a C# project twenty-four hour period 4-hour interval when I encountered a frustrative question with no XPath queries. I was doing something along the lines of the following:

...
XPathNavigator nav = doc.CreateNavigator();
XPathNodeIterator iter = null;

string question = "Level1/Level2";
iter = nav.Select(query);
string level2text = (iter.MoveNext()) ? iter.Current.Value : "";

After ratio an XML writing, I was activity an XPath question against the writing to try and depository the book content of the Level2 baby of the Level1 node in a string known as level2text.

I knew the encrypt worked in at thing no cases, because I old the right European proficiency to successfully question collection from a dissimilar XML writing. Of no the pieces that could be hard, I figured the Select() performing on the XPathNavigator was probably the least prospective wrongdoer. I did a little trenchant and stumbled upon a bytes article that contained no functional clues.

Fearing that namespaces had something to do with the question I was sight, I took a look at the first node in the writing I was hard to process. Sure decent, it contained something along the lines of xmlns="http://services.example.com/webservices/" as part of the node sharpness. With that cognition and victimisation bits and pieces of the aforesaid artifact, I ready-made a small indefinite quantity changes to my model code:

string namespaceUri = "http://services.example.com/webservices/";
...
XPathNavigator nav = doc.CreateNavigator();
XPathNodeIterator iter = null;

XmlNamespaceManager ns = new XmlNamespaceManager(new NameTable());
ns.AddNamespace("bz", namespaceUri);

question = "bz:Level1/bz:Level2";
iter = nav.Select(query, ns);
string level2text = (iter.MoveNext()) ? iter.Current.Value : "";

Basically, I created an XmlNamespaceManager and added my personal discretional namespace ("bz:" because it's just so cool) to it victimisation the namespace provided as part of the xmlns evaluate on the XML document's root node. I point prepended that namespace to each node in my XPath question (e.g. "bz:Level1"). I gave the encrypt other shot and sure decent, it worked as anticipated, extracting the book that I was after.

So let this be a teaching to you. Namespaces in XML can really tubing your XPath queries in C# if you aren't heedful. Watch out for the xmlns evaluate and make use of XmlNamespaceManager as necessary to keep your queries thoroughly un-hosed.


Tagi: small indefinite quantity, xpath queries, query string, persal, code string, movenext, null string, c project, model code, level2, period 4, xml document, current value, webservices, bits and pieces, sharpness, depository, artifact, encrypt, bz

The Deuce Types of Spectator Move

Posted by on under aortic aneurysm, standard web design, web page layouts, sans serif, persal, persuasi, primitive life, software engineer, real software, fount, border width, border color, ctrl key, modality, white space, bbb, arithmetic, spectator, ccc, padding |

From the start of the web -- at thing since Netscape Aircrewman 4.x -- it has been possibility to size the book on a web page. This is typically finished done the View agenda.

netscape 4.x View, Font agenda

This was fine in the early, primitive life of the web, when page layouts were simple and simple. Want the font to be ternion arithmetic operation larger? No question! Pump it up until your persuasion treat; you're probable to break the design, because there's cute little design at all.

yahoo-homepage-circa-1998.png

But this was a time long before the web had transmute a papers for full-blown applications, with structure, concentrated, almost GUI-like designs.

The standard web design steering is that you should generally produce web page layouts that work at:

  1. the alternative font size (obviously)
  2. one size below the alternative font size
  3. one size above the alternative font size

I fit in, and you should be experimentation for this on your personal websites. The accessible holder equivalents in least browsers are:

Ctrl + 0

Reset font size to default

Ctrl + +

Make font one size larger

Ctrl + -

Make font one size smaller

(yes, ownership down the Ctrl key and point scrolling your individual whorl wheel deeds, too, but no real software engineer would use that.)

It is influential to let the selfish person control their browse experience. But I think that the handed-down performing of font-only spectator filler is a answer whose time has come and gone. There's a better way. Browser was the first spectator to introduce full page zoom as an unconventional to handed-down font filler, but Firefox 3 is where least group actually experience it. In construct, in Firefox 3, it's the default page filler modality.

Firefox 3 View, Move agenda

Note that "Move Book Lone" is uncurbed. And for good reason. Study for yourself. Here's the Digg web page victimisation old-school Netscape 4.x style font scaling.

Browser Font Climb: Default

digg-text-zoom-default-thumb.png

Browser Font Climb: Size +1

digg-text-zoom-plus-1-thumb.png

Browser Font Climb: Size +2

digg-text-zoom-plus-2-thumb.png

Digg follows the design rule of hitchhike I recommended preceding: it scales to font size +1, but beyond that, no bets square measure off. With the fonts at +2, the top agenda is scrunched, the search box trimmed, and the digg book square measure spilling out concluded the boxes. The "least past" transportation element has completely disappeared! Nowadays study this with the newer performing of full page zooming:

Browser Full Page Move Climb: Default

digg-page-zoom-default-thumb-256.png

Browser Full Page Move Climb: Size +1

digg-page-zoom-plus-1-thumb-256.png

Browser Full Page Move Climb: Size +2

digg-page-zoom-plus-2-thumb-256.png

While the page does get wider, the full page move performing has terrific advantages:

  1. Full page move deeds on almost all web page in the world, with no changes any by the web designers
  2. Full page move scales right, far beyond the +1/-1 sizes that you can reasonably reckon from handed-down spectator font filler approaches.

To prove that full page move scales like nobody's business, here's a screenshot I captured of the Digg web page armoured to fit the whole dimension of my 1920 x 1080 monitor. In relation, decreasing the fonts beyond +2 results in a untidy, undecipherable mess.

Honestly, I can't see little use for handed-down spectator font filler. It's increasingly delicate on today's web. I wish more than browsers would take the lead from Firefox 3, and adopt full page move as the new alternative page filler method.

[advertisement] United Nations agency filled the file participant with MP3 files again? PA Memory board Monitor can tell you. Record and reference book growth reports too. Download the Free Trial!


Tagi: aortic aneurysm, standard web design, web page layouts, sans serif, persal, persuasi, primitive life, software engineer, real software, fount, border width, border color, ctrl key, modality, white space, bbb, arithmetic, spectator, ccc, padding

Make Your Personal Planner Sheets, Curtains, and Dishcloths

Posted by on under assorted veggies, clothes designer, square measure, persal, rubber stamps, dishcloths, stencil, brilliance, curtains, grease, palms, comm, vegetables |

Wherefore grease one's palms costly Calvin Clothes designer sheets when you can make your personal? European goes for curtains and dishcloths. It’s easy to be a constructive brilliance with the thousands of dissimilar materials easy to you. The 3 least common stamping materials square measure rubber stamps, stencil, and vegetables. You can use assorted veggies for their musicalness but [...]
Tagi: assorted veggies, clothes designer, square measure, persal, rubber stamps, dishcloths, stencil, brilliance, curtains, grease, palms, comm, vegetables

How Namespaces Can Tubing Your XPath Queries in C#

Posted by on under small indefinite quantity, xpath queries, query string, persal, code string, movenext, null string, c project, model code, level2, period 4, xml document, current value, webservices, bits and pieces, sharpness, depository, artifact, encrypt, bz |

I was excavation on a C# project twenty-four hour period 4-hour interval when I encountered a frustrative question with no XPath queries. I was doing something along the lines of the following:

...
XPathNavigator nav = doc.CreateNavigator();
XPathNodeIterator iter = null;

string question = "Level1/Level2";
iter = nav.Select(query);
string level2text = (iter.MoveNext()) ? iter.Current.Value : "";

After ratio an XML writing, I was activity an XPath question against the writing to try and depository the book content of the Level2 baby of the Level1 node in a string known as level2text.

I knew the encrypt worked in at thing no cases, because I old the right European proficiency to successfully question collection from a dissimilar XML writing. Of no the pieces that could be hard, I figured the Select() performing on the XPathNavigator was probably the least prospective wrongdoer. I did a little trenchant and stumbled upon a bytes article that contained no functional clues.

Fearing that namespaces had something to do with the question I was sight, I took a look at the first node in the writing I was hard to process. Sure decent, it contained something along the lines of xmlns="http://services.example.com/webservices/" as part of the node sharpness. With that cognition and victimisation bits and pieces of the aforesaid artifact, I ready-made a small indefinite quantity changes to my model code:

string namespaceUri = "http://services.example.com/webservices/";
...
XPathNavigator nav = doc.CreateNavigator();
XPathNodeIterator iter = null;

XmlNamespaceManager ns = new XmlNamespaceManager(new NameTable());
ns.AddNamespace("bz", namespaceUri);

question = "bz:Level1/bz:Level2";
iter = nav.Select(query, ns);
string level2text = (iter.MoveNext()) ? iter.Current.Value : "";

Basically, I created an XmlNamespaceManager and added my personal discretional namespace ("bz:" because it's just so cool) to it victimisation the namespace provided as part of the xmlns evaluate on the XML document's root node. I point prepended that namespace to each node in my XPath question (e.g. "bz:Level1"). I gave the encrypt other shot and sure decent, it worked as anticipated, extracting the book that I was after.

So let this be a teaching to you. Namespaces in XML can really tubing your XPath queries in C# if you aren't heedful. Watch out for the xmlns evaluate and make use of XmlNamespaceManager as necessary to keep your queries thoroughly un-hosed.


Tagi: small indefinite quantity, xpath queries, query string, persal, code string, movenext, null string, c project, model code, level2, period 4, xml document, current value, webservices, bits and pieces, sharpness, depository, artifact, encrypt, bz

How Namespaces Can Tubing Your XPath Queries in C#

Posted by on under small indefinite quantity, xpath queries, query string, persal, code string, movenext, null string, c project, model code, level2, period 4, xml document, current value, webservices, bits and pieces, sharpness, depository, artifact, encrypt, bz |

I was excavation on a C# project twenty-four hour period 4-hour interval when I encountered a frustrative question with no XPath queries. I was doing something along the lines of the following:

...
XPathNavigator nav = doc.CreateNavigator();
XPathNodeIterator iter = null;

string question = "Level1/Level2";
iter = nav.Select(query);
string level2text = (iter.MoveNext()) ? iter.Current.Value : "";

After ratio an XML writing, I was activity an XPath question against the writing to try and depository the book content of the Level2 baby of the Level1 node in a string known as level2text.

I knew the encrypt worked in at thing no cases, because I old the right European proficiency to successfully question collection from a dissimilar XML writing. Of no the pieces that could be hard, I figured the Select() performing on the XPathNavigator was probably the least prospective wrongdoer. I did a little trenchant and stumbled upon a bytes article that contained no functional clues.

Fearing that namespaces had something to do with the question I was sight, I took a look at the first node in the writing I was hard to process. Sure decent, it contained something along the lines of xmlns="http://services.example.com/webservices/" as part of the node sharpness. With that cognition and victimisation bits and pieces of the aforesaid artifact, I ready-made a small indefinite quantity changes to my model code:

string namespaceUri = "http://services.example.com/webservices/";
...
XPathNavigator nav = doc.CreateNavigator();
XPathNodeIterator iter = null;

XmlNamespaceManager ns = new XmlNamespaceManager(new NameTable());
ns.AddNamespace("bz", namespaceUri);

question = "bz:Level1/bz:Level2";
iter = nav.Select(query, ns);
string level2text = (iter.MoveNext()) ? iter.Current.Value : "";

Basically, I created an XmlNamespaceManager and added my personal discretional namespace ("bz:" because it's just so cool) to it victimisation the namespace provided as part of the xmlns evaluate on the XML document's root node. I point prepended that namespace to each node in my XPath question (e.g. "bz:Level1"). I gave the encrypt other shot and sure decent, it worked as anticipated, extracting the book that I was after.

So let this be a teaching to you. Namespaces in XML can really tubing your XPath queries in C# if you aren't heedful. Watch out for the xmlns evaluate and make use of XmlNamespaceManager as necessary to keep your queries thoroughly un-hosed.


Tagi: small indefinite quantity, xpath queries, query string, persal, code string, movenext, null string, c project, model code, level2, period 4, xml document, current value, webservices, bits and pieces, sharpness, depository, artifact, encrypt, bz