Menu

Examples

David Rueter

--Example 1: Simple parse of string

:::sql
EXEC #spactDOMLoad
  @HTML = '<html><body>Hello World.<br /><div><p>SQLDOM <b>ROCKS!</b></p></div></body></html>'

EXEC #spgetDOM 
~~~~~
-------

**--Example 2:** *Render HTML from DOM (that we parsed in Example 1 above)*

:::sql
EXEC #spgetDOMHTML
@PrettyWhitespace=1, @PrintHTML = 1

-------

**--Example 3:**  *Parse and re-render from a URL*

:::sql
DECLARE @HTML varchar(MAX)

EXEC #sputilGetHTTP
@URL = 'http://www.google.com',
@ResponseText = @HTML OUTPUT,
@SuppressResultset = 1

EXEC #spactDOMLoad
@HTML=@HTML

EXEC #spgetDOM

EXEC #spgetDOMHTML
@PrettyWhitespace=1, @PrintHTML = 1

-------

**--Example 4:**  *Parse from a string, modify the DOM, render resulting HTML*

:::sql
EXEC #spactDOMLoad
@HTML = 'Hello World.

Future content goes here
'

EXEC #spactDOMLoad
@HTML = '

Here is some neat stuff about SQLDOM
',
@Selector = '.myContent'

EXEC #spgetDOM

EXEC #spgetDOMHTML
@PrettyWhitespace=1,
@PrintHTML = 1

~~~~


Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.