Jaxcent for .NET

Locating and Adding HTML Elements

Jaxcent contains classes for various HTML elements with various tags, such as JaxcentPara for the P tag, JaxcentAnchor for the A tag, JaxcentDiv for the DIV tag and so on. In addition, there is a JaxcentGenericHtmlElement class that works with any type of tag, and contains a superset of features available on tags.

To work with an HTML element on the page, an object of the appropriate Jaxcent class must be instantiated. But there can be many such as elements, e.g. there are typically many P elements on a page, so a JaxcentPara object must be connected to the right P tag.

There are various methods available in Jaxcent to connect to the right target. The most convenient one is to specify an "ID" property. E.g, the P tag can have an id <P id="messages"> and the matching JaxcentPara can then be instantiated as JaxcentPara messagePara = new JaxcentPara( jaxcentPage, "messages" ); thereby connecting the two via the string "message".

There are other ways to locate the correct target as well. To search for the target, a SearchType class is provided, which specifies the mechanism for searching. Searcing by ID corresponds to SearchType.SearchByID. Other searching methods are SearchByTag, SearchByName, and for INPUT tags, SearchInputByType and SearchInputByValue. SearchByTag will usually have multiple matches, and only the first one will be used, so it is of limited value.

JaxcentGenericHtmlElement also allows searching to see if a particular element exists (without attaching it to an object.) List elements have methods to see if a "Next Sibling" exists, which can be useful in iterating through elements.

Inserting new elements

One of the search types is SearchType.CreateNew. It is not really a search-type at all. But it's included to the "SearchType" class, because everywhere the SearchType class is used, this type can be used.

The purpose of SearchType.CreateNew is to add new elements to the page.

The Jaxcent sample projects provide C# and Visual Basic methods for searching for and adding new elements.